package com.example.xo.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 992c
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    /**
     * 判断是否成功
     */
    private boolean flag;
    /**
     * 状态码
     */
    private int code;
    /**
     * 返回信息
     */
    private String message;
    /**
     * 数据类型 Object 能涵盖所有的数据类型
     */
    private Object data;

    public static Result success(Object data){
        return new Result(true,20000,"成功",data);
    }
    public static Result success(){
        return Result.success(null);
    }
    public static Result error(){
        return new Result(false,-1,"失败",null);
    }

}
